Dynamic documents — reveal.js slides
2024-09-18
There are three currently-supported formats for making presentations using Quarto
reveal.js
MS PowerPoint
LaTeX Beamer
Each of these requires some unique knowledge
reveal.js — to go beyond applying a theme you need to know a little about Cascading Style Sheets (CSS)
MS PowerPoint — to do any real styling you need to know how to create PowerPoint template files
LaTeX Beamer — to go beyond simple formatting and a few very formal themes, you need to know quite a bit about LaTeX and the Beamer LaTeX package
Of these, reveal.js is the easiest to learn and get to grips with
To create a reveal.js presentation we use the revealjs format provided by quarto
This is slightly different to how the book shows it; I want us to get used to the idea that format: is a list of one or more formats that you can render your slides to.
Note the indentation; revealjs: default is indented by 2 spaces, indicating it is an element of format:
To indicate a new slide, we use a level 2 heading ## Title
---
title: "My Amazing Presentation"
author: "Alice"
format:
revealjs: default
---
## Slide 1
* Bullet 1
* Bullet 2
* Bullet 3
## Slide 2
Some very insightful point I wish to make at this point in the presentation This can be changed with the slide-level option
The level 1 header # Title is used for section slides
If you want to start a slide without a title, you can use --- to indicate the start of a slide without one
If you want to add comments to your Quarto documents, you can’t use # as that is interpretted as Markdown. Instead we can use the HTML comment
Anything between the <!-- and --> will be ignored - can span multiple lines!
Several features require you to define blocks of content
These blocks are called divs, a concept from HTML
We start and end a block with three or more :
It is important that you close a block, otherwise things will go wrong
When you start a block, close it immediately before you enter any further content
If you want to nest one block within another, the outermost block must use at least one more : than an inner block
We can add a class and options to a block by wrapping them in { }
Arguments to the class are passed inside the { } as well
Some people like to incrementally reveal bullets one-by-one
There are two ways to achieve this
globally for all slides using the incremental option in the YAML header
for individual slides using a block with the class .incremental
To use incremental bullets for all slides, set the incremental option to true in the YAML header
Remember that incremental is an option to revealjs, so it must be nested beneath it using indentation, as shown above, with two spaces
To reveal bullets incrementally for selected slides, we use an incremental block
If you have set incremental: true in the YAML header, you can turn this feature off for individual slides using the nonincremental class
If you just want a pause in your slides before you move on to your next point, use . . . (three periods [punktum] sperated by spaces)
Another frequently used slide layout is to place content into columns
We can do that with nested blocks
columnscolumnwidth="50%" to set the relative width of the columnsA theme is an entire set of styles that change how the presentation looks
Quarto provides access to several complete themese
We specify the theme we want to use in the YAML header using the theme option
For a list of supported themes, see the section on reveal.js themes in Quarto’s documentation
You can also modify these themes or even make your own!
We add executable R code using the standard Quarto code block markup
By default, the code for these chuks is not displayed (echoed) in the presentation
Turn temporarily show the code use the echo: true option in the chunk
You can also set this globally for all chunks in the YAML header
To find out more about what you can do with reveal.js slides consult the Quarto documentation for the revealjs format